package com.fxpc.hddc.death.jpa.dao.primary;

import com.fxpc.hddc.death.dto.primary.entity.FxCasualtyLevelMapEntity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;


/**
 * @author zyb
 * @date 2020-11-30
 */
@Repository
public interface FxCasualtyLevelMapBaseDao extends JpaRepository<FxCasualtyLevelMapEntity, String> {

    @Query(nativeQuery = true, value = "select * from fx_casualty_level_map where SUBSTRING(create_time,1,10)= :nowDay AND is_valid = '1' AND extend10= :extend10")
    List<FxCasualtyLevelMapEntity> findOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay,@Param(value = "extend10")String extend10);

    @Query(nativeQuery = true, value = "select * from fx_casualty_level_map where is_valid = '1' AND extend10= :extend10")
    List<FxCasualtyLevelMapEntity> findALlTime(@Param(value = "extend10")String extend10);



    Long count(Specification<FxCasualtyLevelMapEntity> specification);


}
